﻿using PetaPoco;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BrnMall.Manager.Domain.Ship
{
    /// <summary>
    /// 店铺配送余额
    /// </summary>
    [TableName("bma_ShipCash")]
    [PrimaryKey("id")]
    public class ShipCash
    {
        public int id { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        public int Uid { get; set; }
        /// <summary>
        /// 店铺ID
        /// </summary>
        public int StoreId { get; set; }
        /// <summary>
        /// 余额
        /// </summary>
        public string Cash { get; set; }
        /// <summary>
        /// 赠送总金额
        /// </summary>
        public decimal GiveCash { get; set; }

        /// <summary>
        /// 明文的余额，只做显示，无其它作用
        /// </summary>
        public decimal Cash_Decode { get; set; }

        /// <summary>
        /// 达达门店状态 (0未开通, 1 已开通)
        /// </summary>
        public int ShopState { get; set; }
    }

    /// <summary>
    /// 店铺配送设置
    /// </summary>
    [TableName("bma_ShipConfig")]
    [PrimaryKey("id")]
    public class ShipConfig
    {
        public int Id { get;set;}
        /// <summary>
        /// 店铺ID
        /// </summary>
        public int StoreId { get; set; }
        /// <summary>
        /// 是否自动配送(0人工配送, 1 自动配送)
        /// </summary>
        public int IsAutoShip { get; set; }
        /// <summary>
        /// 配送金额
        /// </summary>
        public decimal ShipMoney { get; set; }
        /// <summary>
        /// 最大配送距离(公里)
        /// </summary>
        public float MaxDistance { get; set; }
    }

    /// <summary>
    /// 配送充值的订单记录
    /// </summary>
    [TableName("bma_ShipOrder")]
    [PrimaryKey("id")]
    public class ShipOrder
    {
        public int id { get; set; }
        /// <summary>
        /// 会员ID
        /// </summary>
        public int Uid { get; set; }
        /// <summary>
        /// 店铺ID
        /// </summary>
        public int StoreId { get; set; }

        /// <summary>
        /// 订单号
        /// </summary>
        public string OSN { get; set; }

        /// <summary>
        /// 订单状态
        /// </summary>
        public int OrderState { get; set; }
        /// <summary>
        /// 订单金额
        /// </summary>
        public decimal OrderAmount { get; set; }

        /// <summary>
        /// 赠送金额
        /// </summary>
        public decimal GiveAmount { get; set; }

        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 支付单号
        /// </summary>
        public string paySN { get; set; }
        /// <summary>
        /// 支付时间
        /// </summary>
        public string payTime { get; set; }
        /// <summary>
        /// 预支付ID
        /// </summary>
        public string prepay_id { get; set; }

        /// <summary>
        /// 客户端IP地址
        /// </summary>
        public string IP { get; set; }
    }

    /// <summary>
    /// 配送交易记录
    /// </summary>
    [TableName("bma_ShipRecord")]
    [PrimaryKey("id")]
    public class ShipRecord
    {
        public int id { get; set; }
        /// <summary>
        /// 用户ID
        /// </summary>
        public int Uid { get; set; }
        /// <summary>
        /// 店铺ID
        /// </summary>
        public int StoreId { get; set; }
        /// <summary>
        /// 资金流向 (1 收入,2 支出)
        /// </summary>
        public int Direction { get; set; }

        /// <summary>
        /// 交易金额
        /// </summary>
        public decimal Amount { get; set; }

        /// <summary>
        /// 赠送金额
        /// </summary>
        public decimal GiveAmount { get; set; }

        /// <summary>
        /// 当笔交易后的余额
        /// </summary>
        public decimal Balance { get; set; }

        /// <summary>
        /// 订单号
        /// </summary>
        public string OSN { get; set; }

        /// <summary>
        /// 说明
        /// </summary>
        public string remark { get; set; }

        /// <summary>
        /// 添加时间
        /// </summary>
        public DateTime CreateTime { get; set; }
    }

}
